package NW_MC;

import NWPackage.Calculations;
import Readers.InputsReader;
//import Readers.StaticInputs;

public class MCEntropyCell{
	public String candidateName;
	public int numOfMCruns;
	public double probability;
	public double entropy;
	
	public MCEntropyCell()
	{
		numOfMCruns = 0;
		probability = 0;
		entropy = 0;
	}
	
	public String StringIt(){
		String s = "cand= " + candidateName + " runs= " + numOfMCruns + " prob= "+ probability + " ent= "+entropy + " " ;
		return s;
				
	}
	
	public MCEntropyCell(String candidateName)
	{
		this.candidateName = candidateName;
		numOfMCruns = 0;
		probability = 0;
		entropy = 0;
	}
	
	public int addWin()
	{
		this.numOfMCruns+=1;
		return numOfMCruns;
	}
	public int addWin(double probability)
	{
		this.numOfMCruns+=1;
		this.probability+=probability;
		return numOfMCruns;
	}
	
	public double calcProbability()
	{
		this.probability = (double)(double)numOfMCruns/(double)InputsReader.getMonteCarloRandomProcess();
		return probability;
	}
	
	public double calcEntropy()
	{
		double prob = calcProbability();
		this.entropy = prob*Calculations.Log2(prob);
		return entropy;
	}
	public double calcFullEntropy() {
		this.entropy = this.probability*Calculations.Log2(this.probability);
		return entropy;
	}
	
}
